package com.yimi.yinhepda.adapter.RecycleAdapter;

import android.content.Context;
import android.widget.CheckBox;

import com.yimi.yinhepda.R;
import com.pda.ym.base.CommonRecycleAdapter;
import com.pda.ym.base.CommonViewHolder;
import com.yimi.yinhepda.entity.bean.CurrentSpaceEntity;

import java.util.List;

/**
 * 选择当前场地数据适配器
 *
 * @author 000432
 * @date 2018/6/1 0001
 */

public class MoveSelectCurrentSpaceAdapter extends CommonRecycleAdapter<CurrentSpaceEntity> {

    private CommonViewHolder.onItemCommonClickListener mCommonClickListener;

    public MoveSelectCurrentSpaceAdapter(Context context, List<CurrentSpaceEntity> dataList, CommonViewHolder.onItemCommonClickListener commonClickListener) {
        super(context, dataList, R.layout.adapter_move_select_current_space);
        this.mCommonClickListener = commonClickListener;
    }

    @Override
    public void bindData(CommonViewHolder holder, CurrentSpaceEntity data, int position) {
        holder.setText(R.id.tv_currentSpace, data.getPlaceName());
        CheckBox cbBox = holder.getView(R.id.cb_box);
        holder.setCommonClickListener(mCommonClickListener);
        if (data.isCheck()) {
            cbBox.setChecked(true);
        } else {
            cbBox.setChecked(false);
        }
    }
}
